<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib uri="http://www.ecside.org" prefix="ec"%>
<jsp:useBean id="pageBean" scope="request" class="com.agileai.hotweb.domain.PageBean"/>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>测试方案</title>
<%@include file="/jsp/inc/resource.inc.jsp"%>
<script language="javascript">
function submitTestScheme(){
	var testSchemeId = $('#PT_ID').val();
	if(testSchemeId.length < 36){
		writeErrorMsg('请选中一条记录!');
		return;
	}
	postRequest('form1',{actionType:'submitTestScheme',showSplash:true,onComplete:function(responseText){
		hideSplash();
		if(responseText == 1){
			writeErrorMsg('请将已提交的记录归档后在提交!');
		}else{
			doQuery();
		}
	}});
}

function fileTestScheme(){
	var testSchemeId = $('#PT_ID').val();
	if(testSchemeId.length < 36){
		writeErrorMsg('请选中一条记录!');
		return;
	}
	doSubmit({actionType:'fileTestScheme'});
}

function extractDefectRecord(){
	var testSchemeId = $('#PT_ID').val();
	var defectRecord = $('#defectRecord').val();
	if(testSchemeId.length < 36){
		writeErrorMsg('请选中一条记录!');
		return;
	}
	postRequest('form1',{actionType:'extractDefectRecord',showSplash:true,onComplete:function(responseText){
		hideSplash();
		if(responseText == ""){
			jAlert("无可提取记录！");
		}else{
			jAlert("提取了"+responseText+"条记录！");
		}
	}});
}

function insertTestScheme(){
	var initializeState = $('#initializeState').val();
	if("INITIALIZE" == initializeState){
		writeErrorMsg('请将初始化的记录提交!');
	}else if("SUBMIT" == initializeState){
		writeErrorMsg('请将已提交的记录归档后新增!');
	}else if("empty" == initializeState){
		doRequest('insertRequest');
	}
}
</script>
</head>
<body>
<form action="<%=pageBean.getHandlerURL()%>" name="form1" id="form1" method="post">
<%@include file="/jsp/inc/message.inc.jsp"%>
<div id="__ToolBar__">
<table class="toolTable" border="0" cellpadding="0" cellspacing="1">
<tr>
   <td onmouseover="onMover(this);" onmouseout="onMout(this);" class="bartdx" hotKey="A" align="center" onclick="insertTestScheme()"><input value="&nbsp;" title="新增" type="button" class="createImgBtn" />新增</td>
   <td onmouseover="onMover(this);" onmouseout="onMout(this);" class="bartdx" hotKey="E" align="center" onclick="doRequest('updateRequest')"><input id="editBtn" value="&nbsp;" title="编辑" type="button" class="editImgBtn" />编辑</td>
<!--    <td onmouseover="onMover(this);" onmouseout="onMout(this);" class="bartdx" hotKey="C" align="center" onclick="doRequest('copyRequest')"><input value="&nbsp;" title="复制" type="button" class="copyImgBtn" />复制</td> -->
   <td onmouseover="onMover(this);" onmouseout="onMout(this);" class="bartdx" hotKey="V" align="center" onclick="doRequest('viewDetail')"><input value="&nbsp;" title="查看" type="button" class="detailImgBtn" />查看</td>
   <td onmouseover="onMover(this);" onmouseout="onMout(this);" class="bartdx" hotKey="S" align="center" onclick="submitTestScheme()"><input id="submitBtn" value="&nbsp;" title="提交" type="button" class="submitImgBtn" />提交</td>
   <td onmouseover="onMover(this);" onmouseout="onMout(this);" class="bartdx" hotKey="F" align="center" onclick="fileTestScheme()"><input id="fileBtn" value="&nbsp;" title="归档" type="button" class="detailImgBtn" />归档</td> 
   <td onmouseover="onMover(this);" onmouseout="onMout(this);" class="bartdx" hotKey="E" align="center" onclick="extractDefectRecord()"><input id="extractBtn" value="&nbsp;" title="提取" type="button" class="extractImgBtn" />提取</td>
   <td onmouseover="onMover(this);" onmouseout="onMout(this);" class="bartdx" hotKey="D" align="center" onclick="doDelete($('#'+rsIdTagId).val());"><input id="deleteBtn" value="&nbsp;" title="删除" type="button" class="delImgBtn" />删除</td>
</tr>
</table>
</div>
<div id="__ParamBar__">
<table class="queryTable"><tr><td>
&nbsp;名称<input id="PT_NAME" label="名称" name="PT_NAME" type="text" value="<%=pageBean.inputValue("PT_NAME")%>" size="24" class="text" />

&nbsp;状态<select id="PT_STATE" label="状态" name="PT_STATE" class="select" onchange="doQuery()"><%=pageBean.selectValue("PT_STATE")%></select>

&nbsp;<input type="button" name="button" id="button" value="查询" class="formbutton" onclick="doQuery()" />
</td></tr></table>
</div>
<ec:table 
form="form1"
var="row"
items="pageBean.rsList" csvFileName="测试方案.csv"
retrieveRowsCallback="process" xlsFileName="测试方案.xls"
useAjax="true" sortable="true"
doPreload="false" toolbarContent="navigation|pagejump |pagesize |export|extend|status"
width="100%" rowsDisplayed="15"
listWidth="100%" 
height="390px"
>
<ec:row styleClass="odd" ondblclick="doRequest('viewDetail')" oncontextmenu="selectRow(this,{PT_ID:'${row.PT_ID}'});refreshConextmenu()" onclick="selectRow(this,{PT_ID:'${row.PT_ID}'});controlUpdateBtn('${row.PT_STATE}')">
	<ec:column width="50" style="text-align:center" property="_0" title="序号" value="${GLOBALROWCOUNT}" />
	<ec:column width="100" property="PT_NAME" title="名称"   />
	<ec:column width="100" property="PT_STATE" title="状态"  mappingItem="PT_STATE" />
	<ec:column width="100" property="PT_CREATE_NAME" title="创建人员"   />
	<ec:column width="100" property="PT_TIME" title="创建时间" cell="date" format="yyyy-MM-dd HH:mm" />
	<ec:column width="100" property="PT_PUBLISHER_NAME" title="发布人员"   />
	<ec:column width="100" property="PT_PUBL_TIME" title="发布时间" cell="date" format="yyyy-MM-dd HH:mm" />
</ec:row>
</ec:table>
<input type="hidden" name="PT_ID" id="PT_ID" value="" />
<input type="hidden" name="PI_ID" id="PI_ID" value="<%=pageBean.inputValue("PI_ID")%>"/>
<input type="hidden" name="defectRecord" id="defectRecord" value="<%=pageBean.inputValue("defectRecord")%>"/>
<input type="hidden" name="initializeState" id="initializeState" value="<%=pageBean.inputValue("initializeState")%>"/>
<input type="hidden" name="actionType" id="actionType" />
<script language="JavaScript">
setRsIdTag('PT_ID');
var ectableMenu = new EctableMenu('contextMenu','ec_table');

function controlUpdateBtn(stateResult){
	if(stateResult =='INITIALIZE'){
		enableButton("submitBtn");
		enableButton("deleteBtn");
		enableButton("extractBtn");
		enableButton("editBtn");
		disableButton("fileBtn");
	}else if(stateResult =='SUBMIT'){
		enableButton("fileBtn");
		disableButton("editBtn");
		disableButton("submitBtn");
		disableButton("extractBtn");
		disableButton("deleteBtn");
	}else if(stateResult =='FILE'){
		enableButton("deleteBtn");
		disableButton("editBtn");
		disableButton("submitBtn");
		disableButton("fileBtn");
		disableButton("extractBtn");
	}
}
</script>
</form>
</body>
</html>
<%@include file="/jsp/inc/scripts.inc.jsp"%>
